﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Primitives;

namespace PrismRegion.Base
{
    public class CustomRegion : RegionAdapterBase<UniformGrid>
    {
        public CustomRegion(IRegionBehaviorFactory regionBehaviorFactory) : base(regionBehaviorFactory)
        {
        }

        protected override void Adapt(IRegion region, UniformGrid regionTarget)
        {
            region.Views.CollectionChanged += (o, e) => {

                foreach (UIElement view in region.Views)
                {
                    regionTarget.Children.Add(view);
                }
            };
        }

        protected override IRegion CreateRegion()
        {
            return new AllActiveRegion(); 
        }
    }
}
